<template>
<div>
  <div class="banner" @click="handleOpenGallary">
    <img class="banner-img" :src="bannerImg" alt="">
    <div class="banner-info">
      <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">   <span class="iconfont banner-icon" >
     &#xe695;
   </span>39</div>
    </div>
  </div>
  <common-fade>
  <common-gallary :images="gallaryImgs" @close="handleCloseGallary" v-show="isOpenGallary" ></common-gallary>
  </common-fade>
</div>
</template>
<script>
import commonGallary from "common/gallary/gallary";
import commonFade from 'common/fade/fadeAnimation'
export default {
  name: "banner",
  props:['sightName','bannerImg','gallaryImgs'],
  components: {
    commonGallary,
    commonFade
  },
  data() {
    return {
      isOpenGallary: false,
      images: [
        "http://img1.qunarzz.com/sight/p0/1601/8c/8ce47f061761051190.img.jpg_r_800x800_615106bd.jpg",
        "http://img1.qunarzz.com/sight/p0/1601/1e/1ed9463ad45e462390.img.jpg_r_800x800_c17c711b.jpg"
      ]
    };
  },
  methods: {
    handleOpenGallary() {
      this.isOpenGallary = true;
    },
    handleCloseGallary() {
      this.isOpenGallary = false;
    }
  }
};
</script>
<style lang="stylus" scoped>
.banner {
  /* * 一开始对轮播图进行占位。 防止一开始或者后面的滑动时， 图片产生抖动
  // overflow hidden;
  // height 0;
  // padding-bottom 50%;
  // .banner-img{
  // width 100%
  // }
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)); CSS3 颜色渐变
  */
  overflow: hidden;
  height: 0;
  padding-bottom: 50%;
  position: relative;

  .banner-img {
    width: 100%;
  }

  .banner-info {
    display: flex;
    // align-content center;
    position: absolute;
    left: 0;
    bottom: 0;
    right: 0;
    line-height: 0.2rem;
    height: 0.6rem;
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
    color: #fff;

    .banner-title {
      flex: 1;
      font-size: 0.32rem;
      padding: 0.2rem;
    }

    .banner-number {
      // height: 0.62rem;
      line-height: 0.6rem;
      width: 0.62rem;
      // padding: 0.2rem;
      border-radius: 0.2rem;
      // background: rgba(0, 0, 0, 0.8);
      font-size: 0.24rem;

      .banner-icon {
        font-size: 0.24rem;
      }
    }
  }
}
</style>


